using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_FeeCount : Admin, IRequiresSessionState
{
	protected Literal lbCount;
	protected TextBox txtUserName;
	protected Button SearchButton;
	protected Repeater gvView;
	protected Label PagePanel;
	protected Button Allselect;
	protected Button NotSelect;
	protected Button ButDel;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.IsPostBack)
		{
			this.BindList();
		}
	}
	protected void BindList()
	{
		int num = Fetch.GetID("page");
		if (num == 0)
		{
			num = 1;
		}
		Pagination pagination = new Pagination();
		this.gvView.DataSource = pagination.GetDataTable("HLView_Records", num, 12, "Id", " WHERE UserName LIKE'%" + this.txtUserName.Text + "%'", "", this.conn, null);
		this.gvView.DataBind();
		this.lbCount.Text = this.conn.GetScalar("SELECT sum(Monery) FROM HLView_Records WHERE UserName LIKE'%" + this.txtUserName.Text + "%'", new IDbDataParameter[0]).ToString();
		this.PagePanel.Text = pagination.ShowPagePanel();
	}
	protected void SearchButton_Click(object sender, EventArgs e)
	{
		this.BindList();
	}
	protected void Allselect_Click(object sender, EventArgs e)
	{
		for (int i = 0; i < this.gvView.Items.Count; i++)
		{
			CheckBox checkBox = (CheckBox)this.gvView.Items[i].FindControl("CheckBox1");
			checkBox.Checked = true;
		}
	}
	protected void Notselect_Click(object sender, EventArgs e)
	{
		for (int i = 0; i < this.gvView.Items.Count; i++)
		{
			CheckBox checkBox = (CheckBox)this.gvView.Items[i].FindControl("CheckBox1");
			checkBox.Checked = false;
		}
	}
	protected void ButDel_Click(object sender, EventArgs e)
	{
		string text = "";
		int num = 0;
		for (int i = 0; i < this.gvView.Items.Count; i++)
		{
			CheckBox checkBox = (CheckBox)this.gvView.Items[i].FindControl("CheckBox1");
			HiddenField hiddenField = (HiddenField)this.gvView.Items[i].FindControl("HiddenID");
			if (checkBox.Checked)
			{
				text = text + hiddenField.Value + ",";
			}
		}
		try
		{
			num = this.conn.Execute("delete HLShop_Records where ID in(" + text.Substring(0, text.Length - 1) + ")");
		}
		catch (Exception ex)
		{
			ex.WriteErrorLog(new string[]
			{
				"正常操作"
			});
			num = 0;
		}
		if (num > 0)
		{
			this.BindList();
		}
	}
}
